#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author:    thepoy
# @Email:     thepoy@163.com
# @File Name: mysql_pymysql.py
# @Created:   2021-12-28 09:35:47
# @Modified:  2021-12-28 15:10:17

import pymysql


def main():
    conn = pymysql.connect(
        host="",
        user="",
        passwd="",
        database="",
    )
    cur = conn.cursor()
    cur.execute("SELECT id FROM items LIMIT 1;")
    row = cur.fetchone()
    if not row:
        raise Exception("没有结果")
    print(f"result: id={row[0]}")


if __name__ == "__main__":
    main()
